		var remark={
			cursor:"选择指针",
			task:"任务结点",
			node:"子流程结点",
			"join":"分支结点"
		};
		function menuHandler(item){
			switch(item.name){
			case 'edit' : flow.dbClickEvent(flow.$rightNode);break;
			case 'mobileWarning' : alert('短信提醒');break;
			case 'SystemWarning' : alert('系统提醒');break;
			case 'EmailWarning' : alert('邮件提醒');break;
			}
		}
		var editIndex = undefined;
		function endEditing(ed){
			if (editIndex == undefined){return true}
			if ($('#exeResult').datagrid('validateRow', editIndex)){
				$('#exeResult').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
				var ed = $('#exeResult').datagrid('getEditor', {index:editIndex,field:'toNode'});
				var selValue = $(ed.target).combobox('getValue');
				var data = $(ed.target).combobox('getData');
				for(var i=0;i<data.length;i++){
					if(data[i].toNode == selValue){
						$('#exeResult').datagrid('getData').rows[editIndex].nodeName = data[i].nodeName;
						break;
					}
				}
				$('#exeResult').datagrid('endEdit', editIndex);
				editIndex = undefined;
				return true;
			} else {
				return false;
			}
		}
		function onClickRow(index){
			if (editIndex != index){
				if (endEditing()){
					$('#exeResult').datagrid('selectRow', index).datagrid('beginEdit', index);
					editIndex = index;
					var ed = $('#exeResult').datagrid('getEditor', {index:index,field:'toNode'});
					var data = setComboboxData(ed.oldHtml);
					$(ed.target).combobox('loadData',data);
					$('#exeResult').datagrid('selectRow', index).datagrid('beginEdit', index);
					
					if(flow.$nodeData[flow.$nodeData[selNodeId]['nextNode']].name == ed.oldHtml){
						$(ed.target).combobox('disable');
					}
				} else {
					$('#exeResult').datagrid('selectRow', editIndex);
				}
			}
		}
		function accept(){
			if (endEditing()){
				$('#exeResult').datagrid('acceptChanges');
				return true;
			}
			return false;
		}
		function flowResultDir(){
			var gridData = $('#exeResult').datagrid('getData');
			var toNode,lineNode,isExists = false,linesName='';
			for(var i=0;i<gridData.rows.length;i++){
				toNode = gridData.rows[i].toNode;
				isExists = false;
				for(var lineName in flow.$lineData){
					if(flow.$lineData[lineName].from == selNodeId && flow.$lineData[lineName].to == toNode){
						isExists = true;
						lineNode = lineName;
						break;
					}
				}
				if(!isExists){
					lineName = 'line_'+flow.$max;
					flow.$max++;
				}
				if(!isExists || (isExists && (flow.$lineData[lineNode].name != gridData.rows[i].handleResult || flow.$lineData[lineNode].to != gridData.rows[i].toNode))){
					flow.reDrawLine(lineName,[flow.$nodeData[selNodeId].left,flow.$nodeData[selNodeId].top],[flow.$nodeData[toNode].left,
						flow.$nodeData[toNode].top],true,true,gridData.rows[i].handleResult,selNodeId,toNode);
				}
				if(i == gridData.rows.length-1){
					linesName += lineName;
				}else{
					linesName += lineName+',';
				}
			}
			//清理之前多余的划线
			var oldeLinesNameArr = flow.$nodeData[selNodeId].lines.split(',');
			var newLinesNameArr = linesName.split(',');
			for(var i=0;i<oldeLinesNameArr.length;i++){
				isExists = false;
				for(var j=0;j<newLinesNameArr.length;j++){
					if(oldeLinesNameArr[i] == newLinesNameArr[j]){
						isExists = true;
					}
				}
				if(!isExists){
					flow.delLine(oldeLinesNameArr[i]);
				}
			}
			flow.$nodeData[selNodeId].lines = linesName;
		}
		
		function exeResultDir(nodeId,data){
			selNodeId = nodeId;
			flow.$nodeData[nodeId]['conditions'] = data;
			$('#exeResult').datagrid('loadData',data); 
		}
		var selNodeId;
		function showExeResultDir(nodeId){
			selNodeId = nodeId;
			var data = flow.$nodeData[nodeId]['conditions'];
			for(var node in data){
				if(node != 'remove'){
					data[node].nodeName=flow.$nodeData[data[node].toNode].name;
				}
			}
			$('#exeResult').datagrid('loadData',flow.$nodeData[nodeId]['conditions']); 
		}
		
		function setComboboxData(nodeValue){
			var jsonData,nodePoint,data=new Array(),i=0,isExists = false;
			var recordData = flow.$nodeData[selNodeId]['conditions'];
			for(var node in flow.$nodeData){
				nodePoint = flow.$nodeData[node];
				if(nodePoint.type == 'task' && node != 'start' || node == 'end'){
					/*isExists = false;
					for(var j=0;j<recordData.length;j++){
						if(recordData[j].toNode == node || flow.$nodeData[selNodeId].preNode == node){
							if(!nodeValue || (!nodeValue || recordData[j].nodeName != nodeValue)){
								isExists = true;
							}
						} 
					}
					if(!isExists){*/
						jsonData = {toNode:node,nodeName:nodePoint.name};
						data[i] = jsonData;
						i++;
					//}
				}
			}
			return data;
		}
		
		function append(){
			if (endEditing()){
				$('#exeResult').datagrid('appendRow',{status:'P'});
				editIndex = $('#exeResult').datagrid('getRows').length-1;
				$('#exeResult').datagrid('selectRow', editIndex)
						.datagrid('beginEdit', editIndex);
				var ed = $('#exeResult').datagrid('getEditor', {index:editIndex,field:'toNode'});
				var data = setComboboxData();
				$(ed.target).combobox('loadData',data);
			}
		}
		function removeConditionData(){
			if (editIndex == undefined){return}
			if($('#exeResult').datagrid('getData').rows.length < 3){
				alert('分支节点最少要保留两个分支，删除失败！');
				return;
			}
			$('#exeResult').datagrid('cancelEdit', editIndex)
					.datagrid('deleteRow', editIndex);
			editIndex = undefined;
		}
		var nodeId;
		function getChecked(){
			var nodes = $('#deptPersonTree').tree('getChecked');
			if(nodes.length == 0){
				alert('请选择人员，人员不能为空！');
				return undefined;
			}
			var selValues = new Array(2);
			var names = '';
			var values = '';
			for(var i=0; i<nodes.length; i++){
				if (names != '') {
					names += ',';
					values += ',';
				}
				values += nodes[i].id;
				names += nodes[i].text;
			}
			selValues[0] = names;
			selValues[1] = values;
			var gridData;
			for(var i in flow.$nodeData){
				if(flow.$nodeData[i].type == 'join'){
					gridData = flow.$nodeData[i].data;
					if(gridData){
						for(var j in gridData){
							if(gridData[j].toNode == nodeId){
								gridData[j].nodeName = names;
							}
						}
					}
				}
			}
			return selValues;
		}
		function clearSelect(){
			var nodes = $('#deptPersonTree').tree('getChecked');
			for(var i=0; i<nodes.length; i++){
				$('#deptPersonTree').tree('uncheck', nodes[i].target);
			}
		}